<template>
    <div>
        <button @click="editTitle.editUser">editUser</button>
        <button @click="editTitle.edit">edit</button>
        <button @click="editTitle.update">update</button>
        <button @click="editTitle.change">change</button>
    </div>
</template>

<script lang="ts" setup>
import { ref } from "vue";
 export interface Iuser{
    id?:number
    name:string
    age:number
    sex:string
}
const emit=defineEmits<{
    (e:'change',id:number):void
    (e:'update',val:string):void
    (e:'edit',val1:string,val2:number):void
    (e:'editUser',user:Iuser):void
}>()
const editTitle={
    editUser:function(){
        emit('editUser',{name:'坤哥',age:2.5,sex:'男神'})
    },
    edit:()=>{
        emit('edit','helloworld',18)
    },
    update:()=>{
        emit('update','helloworld')
    },
    change:()=>{
        emit('change',18)
    }
}
</script>